home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / quicktime / music and sound / soundconverter / soundconverter.h < prev    next >
Encoding:
Text File  |  2000-06-23  |  2.5 KB  |  134 lines

  1. //////////
  2. //
  3. //    File:        SoundConverter.h
  4. //
  5. //    Contains:    Sound format conversion sample code.
  6. //
  7. //    Written by:    Bob Aron
  8. //    Revised by:    Tim Monroe
  9. //
  10. //    Copyright:    © 1999 by Apple Computer, Inc., all rights reserved.
  11. //
  12. //    Change History (most recent first):
  13. //
  14. //       <1>         07/01/99    rtm        first file from Bob Aron; conversion to personal coding style; updated to latest headers
  15. //       
  16. //////////
  17.  
  18. //////////
  19. //
  20. // header files
  21. //
  22. //////////
  23.  
  24. #ifndef __ERRORS__
  25. #include <Errors.h>
  26. #endif
  27.  
  28. #ifndef __COMPONENTS__
  29. #include <Components.h>
  30. #endif
  31.  
  32. #ifndef __FIXMATH__
  33. #include <FixMath.h>
  34. #endif
  35.  
  36. #ifndef __MOVIES__
  37. #include <Movies.h>
  38. #endif
  39.  
  40. #ifndef __MOVIESFORMAT__
  41. #include <MoviesFormat.h>
  42. #endif
  43.  
  44. #ifndef __QUICKTIMECOMPONENTS__
  45. #include <QuickTimeComponents.h>
  46. #endif
  47.  
  48. #ifndef __SOUND__
  49. #include <Sound.h>
  50. #endif
  51.  
  52. #ifndef __STRINGS__
  53. #include <Strings.h>
  54. #endif
  55.  
  56. #ifndef _STRING_H
  57. #include <string.h>
  58. #endif
  59.  
  60. #ifndef __FP__
  61. #include <fp.h>
  62. #endif
  63.  
  64. #ifndef __QTUtilities__
  65. #include "QTUtilities.h"
  66. #endif
  67.  
  68. #if TARGET_OS_WIN32
  69. #include <math.h>
  70. #endif
  71.  
  72.  
  73. //////////
  74. //
  75. // compiler macros
  76. //
  77. //////////
  78.  
  79. #define FailIf(cond, handler)                                \
  80.     if (cond) {                                                \
  81.         goto handler;                                        \
  82.     }
  83.  
  84. #define FailWithAction(cond, action, handler)                \
  85.     if (cond) {                                                \
  86.         { action; }                                            \
  87.         goto handler;                                        \
  88.     }
  89.  
  90.  
  91. //////////
  92. //
  93. // constants
  94. //
  95. //////////
  96.  
  97. #define kMaxBufferSize                (20*1024)                                     // the upper limit for the in and out conversion buffers
  98. #define kSaveSoundPrompt            "Save sound movie file as:"
  99. #define kSaveSoundFileName            "Sound.mov"
  100. #define kConcertA                    440
  101.  
  102.  
  103. //////////
  104. //
  105. // function prototypes
  106. //
  107. //////////
  108.  
  109. void                                SndConv_DriveAudioConversion (void);
  110.  
  111. OSErr                                SndConv_ConvertSomeUncompressedAudio (    
  112.                                                 Handle theSourceHandle,
  113.                                                 SoundComponentData theSourceInfo,
  114.                                                 unsigned long theSourceTotalFrames, 
  115.                                                 Handle theDestHandle,
  116.                                                 SoundComponentData theDestInfo,
  117.                                                 unsigned long *theDestFramesMoved, 
  118.                                                 CompressionInfo *theDestCompInfo,
  119.                                                 Handle *theDestCompParams);
  120.  
  121. OSErr                                SndConv_CreateSoundMovie (    
  122.                                                 Handle theDestAudioData,
  123.                                                 short theMovieRefNum, 
  124.                                                 Movie theMovie,
  125.                                                 SoundComponentData theDestInfo, 
  126.                                                 Handle *theDestCompParams,
  127.                                                 CompressionInfo theDestCompInfo, 
  128.                                                 unsigned long theDestFrameCount);
  129.  
  130. OSErr                                SndConv_UncompressedSineWaveToHandle (
  131.                                                 Handle theData,
  132.                                                 SoundComponentData *theCompInfo,
  133.                                                 unsigned long *theTotalFrames);
  134.